#Makefile for libbase

CC	= gcc
AR	= ar
RANLIB	= ranlib
LIB	= libbase.a
SOURCES = audio.c control.c imgadv.c respath.c ttffont.c video.c
OBJS	= $(SOURCES:.c=.o)
DEPENDS = $(OBJS:.o=.d)
CFLAGS	+= `sdl-config --cflags` -Wall -O4
LDFLAGS	+= `sdl-config --libs` -lSDL_ttf -lSDL_image -lSDL_mixer -lSDL_gfx

.PHONY:all clean cleanbak

all:$(LIB)

$(LIB): $(DEPENDS) $(OBJS)
	$(AR) -rc $(LIB) $(OBJS)
	$(RANLIB) $(LIB)
-include $(DEPENDS)
$(DEPENDS):
	@echo -n $@ " " > $@
	@$(CC) -MM $(@:.d=.c) >> $@ $(CFLAGS)
test:
	$(CC) testai.c ../ai.c -ggdb
clean:
	rm -f $(DEPENDS) $(BIN) $(LIB) $(OBJS)

cleanbak:
	rm -f *~

